package untiring.services;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import untiring.interfaces.ZipcodeDAO;
import untiring.interfaces.ZipcodeService;
import untiring.models.ZipcodeVO;

@Service("zipcodeService") 

public class ZipcodeServiceImpl implements ZipcodeService{

	@Autowired
	private ZipcodeDAO zipcodeDAO;

	@Override
	public String readZipcode(String dong) {
		String result = "";
		for(ZipcodeVO z : zipcodeDAO.selectZipcode(dong)){
			if(z.getRi() == null)z.setRi("");
			if(z.getBunji() == null)z.setBunji("");
			result += "<option>" + z.getZipcode() + " " + z.getSido() + " " + z.getGugun() 
					+ " " + z.getDong() + " " + z.getRi() + " " + z.getBunji() + "<option>";
		};
		return result;
	}

	

	

	

}
